﻿using System.Diagnostics;

namespace RaytracerLib
{
    [DebuggerStepThrough]
    public static class DoubleExtensionsRaytracer
    {
        public static bool IsAlmostRelativeEquals(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostRelativeEquals(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostRelativeLessThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostRelativeLessThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostRelativeLessOrEqualThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostRelativeLessOrEqualThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostRelativeGreaterThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostRelativeGreaterThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostRelativeGreaterOrEqualThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostRelativeGreaterOrEqualThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostEquals(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostEquals(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostLessThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostLessThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostLessOrEqualThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostLessOrEqualThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostGreaterThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostGreaterThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        public static bool IsAlmostGreaterOrEqualThen(this double a_d1, double a_d2)
        {
            return TomanuExtensions.DoubleExtensions.IsAlmostGreaterOrEqualThen(
                a_d1, a_d2, Constants.DOUBLE_PRECISION);
        }

        /// <summary>
        /// Extension method may cause problem: -d.InRange(a, b) means -(d.AlmostRelvativeInRange(a,b))
        /// </summary>
        /// <param name="a_d"></param>
        /// <param name="a_min_inclusive"></param>
        /// <param name="a_max_inclusive"></param>
        /// <returns></returns>
        public static bool AlmostRelvativeInRange(double a_d, double a_min_inclusive,
            double a_max_inclusive)
        {
            Debug.Assert(a_min_inclusive <= a_max_inclusive);

            return TomanuExtensions.DoubleExtensions.AlmostRelvativeInRange(a_d, a_min_inclusive, a_max_inclusive,
                Constants.DOUBLE_PRECISION);
        }

        /// <summary>
        /// Extension method may cause problem: -d.InRange(a, b) means -(d.AlmostInRange(a,b))
        /// </summary>
        /// <param name="a_d"></param>
        /// <param name="a_min_inclusive"></param>
        /// <param name="a_max_inclusive"></param>
        /// <returns></returns>
        public static bool AlmostInRange(double a_d, double a_min_inclusive,
            double a_max_inclusive)
        {
            return TomanuExtensions.DoubleExtensions.AlmostRelvativeInRange(a_d, a_min_inclusive, a_max_inclusive,
                Constants.DOUBLE_PRECISION);
        }
    }
}